package com.ld.wms.business.approve.controller;


import com.ld.wms.business.approve.service.MaterialExampleInventoryApproveService;
import com.ld.wms.business.approve.vo.req.ApproveReqVo;
import com.ld.wms.business.approve.vo.req.MaterialExampleInventoryApproveReqVo;
import com.ld.wms.business.approve.vo.resp.MaterialExampleInventoryApproveRespVo;
import com.ld.wms.common.ResultResponse;
import com.ld.wms.common.vo.GeneratePageListVo;
import com.ld.wms.sysenum.ResultResponseEnum;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
 * <p>
 * 物料实例库存审批列表 前端控制器
 * </p>
 *
 * @author wangfeng
 * @since 2025-04-15
 */
@Slf4j
@Tag(name = "试剂库存审批相关接口")
@RestController
public class MaterialExampleInventoryApproveController {

    @Autowired
    private MaterialExampleInventoryApproveService materialExampleInventoryApproveService;

    @PostMapping("/api/wms/materialExampleInventoryApprove/receiveApprove")
    @Operation(summary = "发送领取申请")
    public ResultResponse<ResultResponseEnum> receiveApprove(
            @RequestBody MaterialExampleInventoryApproveReqVo reqVo
    ) {
        materialExampleInventoryApproveService.receiveApprove(reqVo);
        return ResultResponse.success();
    }

    @PostMapping("/api/wms/materialExampleInventoryApprove/approve")
    @Operation(summary = "审批")
    public ResultResponse<ResultResponseEnum> approve(
            @RequestBody ApproveReqVo reqVo
    ) {
        materialExampleInventoryApproveService.approve(reqVo);
        return ResultResponse.success();
    }

    @GetMapping("/api/wms/materialExampleInventoryApprove/getPageList")
    @Operation(summary = "审批列表")
    public ResultResponse<GeneratePageListVo<MaterialExampleInventoryApproveRespVo>> getPageList(
            @Parameter(description = "当前页数") @RequestParam(defaultValue = "1") Integer current,
            @Parameter(description = "每页展示条数") @RequestParam(defaultValue = "10") Integer size
    ) {
        GeneratePageListVo<MaterialExampleInventoryApproveRespVo> pageList = materialExampleInventoryApproveService.getPageList(current, size);
        return ResultResponse.success(pageList);
    }

}

